/**
  ******************************************************************************
  * @file           : motion_service.h
  * @brief          : Header for motion_service.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *	Created by Chen Lu in 20210606
  *
  ******************************************************************************
  */

#ifndef __MOTION_SERVICE_H
#define __MOTION_SERVICE_H

#include "main.h"
#include "motor.h"
#include "axis.h"
#include "queue.h"
#include "sio_service.h"

#define MOTIONSERVICE_OK		1
#define MOTIONSERVICE_ERROR		0

//Instruction types
#define MOV_ROTATE				1
#define MOV_ZERO				2
#define	MOV_STOP				3
#define MOV_START				4
#define GET_ANGLE				5
#define OBJ_CLOSE				6
#define OBJ_OPEN				7

typedef struct {
	TiMotor* motor[3];			//maybe ambiguous
	TiAxis* axis[3];
}TiMotionService;

TiMotionService * mcs_open(void);
uint8_t mcs_close(TiMotionService * mcs);
uint8_t mcs_returnzero(TiMotionService * mcs);
uint8_t mcs_interpret(uint8_t * request, uint8_t length, uint8_t * response, uint8_t* p_type);
uint8_t mcs_PID(TiMotionService * mcs, TiTask * task, float KP, float KI, float KD);

#endif /*__MOTION_SERVICE_H */
